// 获取svg图标(id)列表
export const getIconList = () => {
  const rs = []
  const list = document.querySelectorAll('svg symbol[id^="icon-"]')
  for (let i = 0; i < list.length; i++) {
      rs.push(list[i].id)
  }
  return rs
}

// 转换文件大小格式
export const sizeFormat = (size) => {
    const unit = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']
    let index = Math.floor(Math.log(size) / Math.log(1024))
    let newSize = size / Math.pow(1024, index)
    return newSize.toFixed(2) + ' ' + unit[index]
}

